﻿using UnityEngine;

namespace winS.Unity.Geometry
{
    /// <summary>
    /// 球形
    /// </summary>
    public struct Sphere
    {
        public float radius { get; set; }
        public Vector3 center { get; set; }

        public Sphere(Vector3 center, float radius)
        {
            this.center = center;
            this.radius = radius;
        }

        /// <summary>
        /// 是否包含位置
        /// </summary>
        public bool Contains(Vector3 position)
        {
            return Vector3.Distance(center, position) < radius;
        }
    }
}